package com.liliya.service.impl;

import com.liliya.dao.OrderDao;
import com.liliya.dao.impl.OrderDaoImpl;
import com.liliya.pojo.Order;
import com.liliya.service.OrderService;

import java.util.List;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2021/2/21 10:12
 */
public class OrderServiceImpl implements OrderService {
    private OrderDao orderDao = new OrderDaoImpl();

    @Override
    public List<Order> findOrders() {
        return orderDao.findOrders();
    }

    @Override
    public List<Order> findOrdersOK() {
        return orderDao.findOrdersOK();
    }

    @Override
    public int total() {
        return orderDao.total();
    }

    @Override
    public int totalOK() {
        return orderDao.totalOK();
    }

    @Override
    public List<Order> findOrdersByRow(int start, int end) {
        return orderDao.findOrdersByRow(start,end);
    }

    @Override
    public List<Order> findOrdersOKByRow(int start, int end) {
        return orderDao.findOrdersOKByRow(start,end);
    }

    @Override
    public Integer findPage(Integer step) {
        Integer page = null;
        Integer total = total();
        if (total%step==0){
            page = total/step;
        }else {
            page = total/step + 1;
        }
        return page;
    }

    @Override
    public Integer findPageOK(Integer step) {
        Integer page = null;
        Integer total = totalOK();
        if (total%step==0){
            page = total/step;
        }else {
            page = total/step + 1;
        }
        return page;
    }

    @Override
    public Order findOrderByOrderNum(Integer orderNum) {
        return orderDao.findOrderByOrderNum(orderNum);
    }


}
